<template>
	<view class="pages-box padding30 bg-white">
		<view class="details-box">			
			<view class="details">
				<u-parse :html="details"></u-parse>
			</view>
		</view>
	</view>
</template>

<script>
	import {newsDetails} from "@/api/news.js"
	import {mapGetters} from "vuex";
	export default {
		computed: mapGetters(['isLogin','uid']),
		data() {
			return {
				adminUrl:this.$config.Http_admin_url,
				id:0,
				img:'',
				name:'',
				addtime:'',
				phone:'',
				addr:'',
				volume:0,
				details:''
			};
		},
		onLoad(options) {
			if(options.id){
				this.id=options.id
			}
		},
		onShareAppMessage: function() {
			return {
				title: this.$config.shareTitle,
				imageUrl: this.adminUrl+'/upload/goulogo.png',
				desc: this.$config.shareTitle,
				path: `/pages/news/details/index?id=${this.id}&uid=${this.uid}`
			};
		},
		onShareTimeline: function() {
			return {
				title: this.shareTitle,
				imageUrl: this.adminUrl+'/upload/goulogo.png',
				desc: this.shareTitle,
				path: `/pages/news/details/index?id=${this.id}&uid=${this.uid}`
			};
		},
		mounted() {
			this.getDetails()
		},
		methods:{
			getDetails(){
				newsDetails(this.id).then(res=>{
					if(res.code == 900){
						this.img=this.adminUrl+res.data.pic
						this.name=res.data.title
						this.addtime=res.data.addtime
						this.phone=res.data.tel
						this.addr=res.data.address
						this.volume=res.data.volume
						this.details=res.data.contents
						uni.setNavigationBarTitle({
							title: this.name
						});
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.pages-box{
		// background-color: #f2f2f2;
		.shop-info{
			.item{
				padding: 10rpx 0;
				.iconfont{
					font-size: 42rpx;
					font-weight: 600;
				}
			}
		}
		.details-box{
			.title{
				color: #6B6B6B;
				border-bottom: #D6D6D6 2rpx solid;
				padding:10rpx;
				margin-bottom: 20rpx;
			}
			.details{
				padding:10rpx;
			}
		}
	}
	.bg-white{
		// background-color: #ffffff;
	}
</style>
